import subprocess
import datetime

class Model:
    def __init__(self, name, log_dir, ssh_host='', ssh_user='', ssh_password='', ssh_port='', local_volumn='', remote_volumn=''):
        self.name = name 
        self.log_dir = log_dir
        self.ssh_host = ssh_host
        self.ssh_user = ssh_user
        self.ssh_password = ssh_password
        self.ssh_port = ssh_port
        self.local_volumn = local_volumn
        self.remote_volumn = remote_volumn

def send_message(type="send_message", cur_time, content, loss):
    curl_command = """curl --location --request POST 'https://flagopen.baai.ac.cn/warning/send_message' \
        --header 'Content-Type: application/json' \
        --data-raw '{
            "text": "Aquila7B\\n 模型训练正在进行中; 当前时间为""" + str(cur_time) + """, \\n 进程： """+content+""", \\n               当前loss为 """+str(loss)+"""",
        }'"""
    subprocess.run(curl_command, shell=True)


model_30B = Model(name='Aquila30B', log_dir='/share/project/64node-bmt-flashatten/Aquila-30b-64n8g-from-scratch/202304251033/Aquila-30b-64n8g.yaml.log.txt')


models_watched = [model_30B]
while True:
    if model_30B in models_watched:
        # Get the modified time of the log file
        mod_time = os.path.getmtime(file_path)
        time_elapsed = time.time() - mod_time
        if time_elapsed > 3600:  #if not modified every hour
            send_message


        time_print = datetime.datetime.now()
    
    # Execute the script every hour
    time.sleep(3500)










